package Dungeon;

import SquarePackage.Square;
import be.kuleuven.cs.som.annotate.Model;

/**
 * Class for a level, a dungeon with only one level.
 * 
 * @invar	All coordinates are positive and smaller than the maximum value.
 * 			| isValidDimension()
 * @invar	The maximum dimension has as Z-value always one. 
 * 			| isValidMaxDimension(maxDimension)
 * 
 * @author 	Brecht Reynders en Florian Hendrickx
 * @version	1.0
 */
public class Level extends Dungeon {
	
	/**
	 * Initializes a new level with the given coordinates for the maximum and one as the maximum Z-coordinate value.
	 * 
	 * @param 	maxX
	 * 			The maximum x-coordinate value.
	 * @param 	maxY
	 * 			The maximum y-coordinate value.
	 * @effect	The new dungeon is initialized with the given coordinates and 1 as the new maximum z-coordinate value.
	 * 			| super(maxX, maxY, 1)
	 */
	public Level(long maxX, long maxY){
		super(maxX, maxY,1);
	}
	
	/**
	 * Initializes a new dungeon with the given dimension as maximum dimension.
	 * 
	 * @param	maxDimension
	 * 			The new maximum dimension.
	 * @effect	The new dungeon gets initialized with the given coordinates.
	 * 			| super(maxDimension)
	 */
	public Level(Dimension maxDimension){
		if(isValidMaxDimension(maxDimension))
			setMaxDimension(maxDimension);
	}
	
	/**
	 * Initializes a new level with 20 as the maximum x- and y-coordinate values and one as the maximum Z-coordinate value.
	 * 
	 * @effect	The new dungeon is initialized with 20 as the new maximum x- and y-coordinates and 1 as the new maximum z-coordinate value.
	 * 			| super(20,20, 1)
	 */
	public Level(){
		super(20,20,1);
	}
	
	/**
	 * Checks whether the given dimension is a valid max dimension.
	 * 
	 * @param 	maxDimension
	 * 			The new wanted maximum dimension.
	 * @return	True if and only if the z-coordinate value equals.
	 * 			| result = maxDimensoin.getZposition()==1
	 */
	private boolean isValidMaxDimension(Dimension maxDimension){
		return maxDimension.getZPosition()==0;
	}
	
	/**
	 * Checks whether the given dimension is a valid new maximum dimension.
	 * 
	 * @param 	maxDimension
	 * 			The new wanted dimension.
	 * @return	True if and only if the dimension is larger than the previous maximum dimension
	 * 			| result = super.isValidNewMaxDimension(maxDimension) && isValidMaxDimension(maxDimension)
	 */
	protected boolean isValidNewMaxDimension(Dimension maxDimension){
		if(super.isValidNewMaxDimension(maxDimension))
			return isValidMaxDimension(maxDimension);
		return false;
	}
	
	/**
	 * Add the given square on the given dimension.
	 * 
	 * @param 	square
	 * 			The square to add.
	 * @param 	dimension
	 * 			The dimension where the square should be added.
	 * @post	The square is added at the given dimension.
	 * 			| getAllSquares().contains(square)
	 * 			| getAllDimensions().contains(dimension)
	 * @throws 	IllegalArgumentException
	 * 			One of the arguments is not a valid argument.
	 * 			| !isValidDimension()||!isValidSquare()
	 */
	@Model @Override
	public void addSquare(Square square, Dimension dimension){
		
	}
}
